//
//  MusicPlayTableViewCell.m
//  OurRelaxDemo
//
//  Created by 王雅蓉 on 15/6/30.
//  Copyright (c) 2015年 于宾尧. All rights reserved.
//

#import "MusicPlayTableViewCell.h"

@interface MusicPlayTableViewCell ()

@end

@implementation MusicPlayTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.SoCangBT = [UIButton buttonWithType:UIButtonTypeCustom];
        //收藏有问题
        [self.SoCangBT setBackgroundImage:[UIImage imageNamed:@"musicCircleHeartDefault.png"] forState:UIControlStateNormal];
        [self.contentView addSubview:self.SoCangBT];
        
        [self.SoCangBT addTarget:self action:@selector(collectionAction:) forControlEvents:UIControlEventTouchUpInside];
        
        //self.count = [[UILabel alloc]init];
        //[self.contentView addSubview:self.count];
        //[_count release];
        self.title = [[UILabel alloc]init];
        [self.contentView addSubview:self.title];
        [_title release];
        self.singer = [[UILabel alloc]init];
        [self.contentView addSubview:self.singer];
        [_singer release];
        
        self.isSelected = NO;
        
    }
    return self;
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    
    self.SoCangBT.frame = CGRectMake(18, 5, 30, self.contentView.frame.size.height - 10);
    //self.count.frame = CGRectMake(60, 0, 30, self.contentView.frame.size.height);
    self.title.frame = CGRectMake(60, 0, self.contentView.frame.size.width - 90, self.contentView.frame.size.height / 2);
    self.singer.frame = CGRectMake(self.title.frame.origin.x, self.contentView.frame.size.height / 2, self.contentView.frame.size.width - 90, self.contentView.frame.size.height / 2);
    
    self.title.font = [UIFont systemFontOfSize:15.0];
    self.title.textColor = [UIColor darkGrayColor];
    self.singer.font = [UIFont systemFontOfSize:12.0];
    self.singer.textColor = [UIColor darkGrayColor];
    
    //self.SoCang.backgroundColor = [UIColor yellowColor];
    //self.count.backgroundColor = [UIColor redColor];
    //self.title.backgroundColor = [UIColor blueColor];
    //self.singer.backgroundColor = [UIColor cyanColor];
}

#pragma mark block方法
- (void)collectionAction:(UIButton *)button
{
    self.block();
}

-(void)setPlayingSonglist:(MusicForSonglist *)playingSonglist
{
    if (_playingSonglist != playingSonglist) {
        
        [_playingSonglist release];
        _playingSonglist = [playingSonglist retain];
        
    }
    
    self.title.text = playingSonglist.song_name;
    self.singer.text = playingSonglist.singer_name;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
